package com.sky.controller.user;

import com.sky.dto.CategoryDTO;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author guozh
 */
@Slf4j
@RestController("UserCategoryController")
@RequestMapping("/user/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    /**
     * 根据类型查询
     *
     * @param type 类型
     * @return List<Category>
     */
    @GetMapping("/list")
    public Result<List<Category>> list(Integer type) {
        log.info("查询分类");
        List<Category> list = categoryService.findByType(type);
        return Result.success(list);
    }
}
